package com.itheima.io.filereader.demo01;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class FileReaderDemo01 {

    public static void main(String[] args) throws IOException {

        FileReader fileReader = new FileReader("itheima-io-filereader\\a.txt");

        //一次读取一个字符
//        int ch = -1;
//        while ((ch = fileReader.read()) != -1) {
//            System.out.print((char) ch);
//        }

        //一次读取一个字节数组
        char[] chs = new char[1024];
        int len = -1;
        while ((len = fileReader.read(chs)) != -1) {
            System.out.println(new String(chs, 0, len));
        }

        fileReader.close();

    }

}
